<?php
class ModelController
{
	public function addModel()
	{
		$modelName    =	Input::get('modelName');
		$tableName    =	Input::get('tableName');
		$fieldNames   =	Input::get('fieldNames');
		$fieldTypes   =	Input::get('fieldTypes');
		$displayNames =	Input::get('displayNames');

		$modelService =	new ModelService;
		$modelService->setModelName($modelName);
		$modelService->setTableName($tableName);
		$modelService->setFieldNames($fieldNames);
		$modelService->setFieldTypes($fieldTypes);
		$modelService->setDisplayNames($displayNames);

		$errCode =	$modelService->addModel();

		return Response::json($errCode);
	}

	public function deleteModel()
	{
		$modelId      =Input::get('id');
		$modelService =	new ModelService;
		$errCode      =$modelService->deleteModel($modelId);
		return Response::json($errCode);
	}
}
?>